package com.lody.virtual.client.hook.proxies.network;

import android.annotation.TargetApi;
import android.os.Build;
import android.util.Log;
import com.lody.virtual.client.hook.base.BinderInvocationProxy;
import com.lody.virtual.client.hook.base.ReplaceUidMethodProxy;
import com.lody.virtual.client.hook.base.StaticMethodProxy;
import java.lang.reflect.Method;
import mirror.android.os.INetworkManagementService;

@TargetApi(Build.VERSION_CODES.M)
public class NetworkManagementStub extends BinderInvocationProxy {

	public NetworkManagementStub() {
		super(INetworkManagementService.Stub.asInterface, "network_management");
	}

	@Override
	protected void onBindMethods() {
		super.onBindMethods();
		addMethodProxy(new ReplaceUidMethodProxy("setUidCleartextNetworkPolicy", 0));
		addMethodProxy(new StaticMethodProxy("setIpForwardingEnabled"){
			@Override
			public Object call(Object who, Method method, Object... args) throws Throwable {
				return super.call(who, method, args);
			}

			@Override
			public boolean beforeCall(Object who, Method method, Object... args) {
				return super.beforeCall(who, method, args);
			}

			@Override
			public Object afterCall(Object who, Method method, Object[] args, Object result) throws Throwable {
				return super.afterCall(who, method, args, result);
			}
		});
	}
}
